1. This invention relates to a code reading apparatus for reading a code (e.g., a bar code) displayed on a medium by scanning it with a photoelectric converter to decode information indicated by the code into a signal to be processed by a computer, thereby outputting the signal and, more particularly, to a code reading apparatus improved in a reading and decoding probability due to the difference of scanning speeds.
2. Description Of The Prior Art
A code reading apparatus of this type is operated to photoelectrically convert a code displayed by various types of code systems on a medium, such as a document or the surface of an article by a scanner, such as an optical reader to decode it into a signal to be processed by a computer, such as a microprocessor and to output it. The code to be displayed includes an exclusive display code, such as a bar code, a calra code, or a general character, and a predetermined standard is provided as a displaying method for decoding the code. There are regulations regarding the displaying interval and range as the standards. For example, there are a regulation of Japanese Industrial Standards (JIS X 0502) for a bar code on pages 3 to 9 (first issue on April 30, 1987) and a regulation of American National Standard (ANSI MH10 8M-1983) on page 8. These displays have a priority difference of compensating range of scanning speed on a bar code displaying portion in cases of not only a pen type but a self-scanning type of hand wand model or installation type of representative optical reader as a scanner, and it is difficult to judge the start and the stop of the code due to the remarkable change of displaying environment as the objects and utilities are variously raised and tends to reduce the decoding probability.
An example of a conventional code reading apparatus of a bar code reader will be described as a representative example of the code reading apparatus of this type with reference to FIGS. 29 and 30. FIG. 29 is a block circuit diagram of a code reading apparatus of a conventional bar code reader, and FIG. 20 is a view for explaining the operation of the bar code reader.
In FIG. 29, a code in which spaces each having a high optical reflection efficiency and bars each having high optical absorptivity of two states are alternately displayed on a medium is detected by a photoelectric converter 1, and converted into an electric signal of predetermined voltage levels, in such a manner that the white space having a high optical reflectivity is converted to a low level (hereinafter referred to an "L") and a black bar having a high optical absorptivity is converted to a high level (hereinafter referred to an "H") of a read signal by a binary circuit 2 of detecting means into a binary signal. The binary signal is applied through a normally open first switch 3 to an edge detector 4 and a fall detector 5. The fall detector 5 detects the edge switched from "H" to "L" at the output of the binary circuit 2 in such a manner that the photoelectric converter 1 is opposed to the white of the start margin provided immediately before the bar code to output a short pulse-like edge detection signal. This edge detection signal is applied to a counter 6 to reset the counter 6 and to start counting incoming clocks, and also to a first self-holding circuit 7 to set the self-holding. The first switch 3 is closed by a slight delay from the edge detection signal by the set state of the first self-holding circuit 7. The edge detector 4 of edge detecting means detects both the edges switched from "L" to "H" and "H" to "L" after the binary signal outputted from the binary circuit 2 by the closure of the first switch 3 to output a short pulse-like edge detection signal. The edge detection signal of the edge detector 4 is applied to the counter 6 of counting means to reset the counter 6 and to start counting, also applied to a normally closed second switch 8 and a normally opened third switch 9, and further applied to the second self-holding circuit 10 to set the self-holding. The third switch 9 is closed by a slight delay by the set of the second self-holding circuit 10, and the following edge detection signal is applied to a bit image converter 11. A counted value of the incoming clock between the edge detection signal and the next edge detection signal by the counter 6 is applied to a comparator 12 and the bit image converter 11. When the counter 6 overflows, a reset signal is outputted to a reset line 13 to reset the counter 6. The counter 6 does not start counting at this time. Another reset signal, not shown, to reset the counter 6 is supplied to the reset line 13 when a power source is energized and by external resetting means. The comparator 12 compares the counted value with a constant value stored in advance in a constant circuit 14 to output a signal in case that the counted value is equal to or larger than the constant value. This signal is applied through a fourth normally open switch 15 to an image character converter 16 as a decode signal, also applied to a third self-holding circuit 17 to set the self-holding. The second switch 8 is opened by a slight delay from the signal from the comparator 12 by the set state of the third self-holding circuit 17, and the fourth switch 15 is closed by a slight delay from the signal. The edge detection signal outputted from the edge detector 4 is applied as a reset signal to the reset line 13 in the state that the second switch 8 is closed. The bit image converter 11 reads the counted value by the edge detection signal applied through the third switch 9 to convert it to an image signal and outputs it to the image character converter 16. The image character converter 16 converts the image signal to a character signal, and outputs the signal applied through the fourth switch 15 as a decode signal to an output circuit 18. The image character converter 16 outputs the reset signal to the reset line 13 if it cannot convert the image signal to the character signal, and resets by itself. When the reset signal is applied from the reset line 13, the image signal and the character signal stored in a memory are cleared. The output circuit 18 converts the character signal to an output format suitably adapted for an external unit to output it, and outputs the reset signal to the reset line 13 when the output is finished. The reset signal of the reset line 13 is further applied to the first, second and third self-holding circuits 7, 10 and 17 to reset the self-holding. The constant value stored in advance in the constant circuit 14 is so set that the photoelectric converter 1 is scanned on the bar code at an ordinary speed to be larger than the counted value obtained from the wide space and the wide bar and to be marginal value by sufficiently considering the variation in the scanning speed of the photoelectric converter 1. Decoding means is formed by the bit image converter 11, the image character converter 16 and the output circuit 18.
The configuration having the above-mentioned start judging sequence is explained with reference to Table 1 in "Manufacture of Bar Code System" described on pages 438 to 451 of the magazine "Transistor Technique" issued by CQ Publishing company, in Japan on Apr. 1, 1984, and the content partly corrected is disclosed in Table 2 of "Manufacture of Bar Code System" described on pages 179 to 199 of "Transistor Technique Edition" of separate volume issued by CQ Publishing company, in Japan on July 1, 1984.
In this configuration, as shown in FIG. 30(1)(a), a sufficient starting margin is provided before the bar code. Thus, when the photoelectric converter 1 is scanned from the starting position sufficiently separated from the bar code on the bar code, the binary circuit 2 outputs the binary signal as shown in FIG. 30(2). The edge (1) falling from "H" to "L" is detected by the fall detector 5, and the counter 6 then starts counting. Then, a counted value ta until the edge (2) rising from "L" to "H" by the initial bar is detected by the edge detector 4 becomes larger than the constant value and the counted value becomes equal to or larger than the constant value before the photoelectric converter 1 arrives at the initial bar. Thus, the comparator 12 outputs a signal, the third self-holding circuit 17 is set, and the second switch 8 is opened. Then, even if the edge detector 4 outputs an edge detection signal at the edge (2) in FIG. 30(2), it is not applied as a reset signal to the reset line 13. The counter 6 starts counting by the edge detection signal at the edge (2) in FIG. 30(2), the second self-holding circuit 10 is set, the third switch 9 is closed, the bit image converter 11 is sequentially reads the counted value counted by the counter 6 between the edge and the next edge by the following edge detection signal. Thus, a suitable start is judged. When the bar code is completely scanned, the variation in the binary signal of the binary circuit 2 is finished, the edge detection signal is not outputted from the edge detector 4, the counted value of the counter 6 is increased, the counted value becomes equal to or smaller than the constant value, and the comparator 13 outputs a signal. Here, the fourth switch 15 is closed, and the signal of the comparator 12 is applied as a decode signal to the image character converter 16 to judge the stop.
A conventional code reading apparatus for judging the final display for a bar code reader will be described as a representative example of such a code reading apparatus with reference to FIGS. 31 and 32. FIG. 31 is a block circuit diagram of a final display discriminator of a conventional bar code reader, and FIG. 32 is a view for explaining the operation of the circuit in FIG. 31.
In FIG. 31, a code in which spaces each having a high optical reflection efficiency and bars each having high optical absorptivity of two states are alternately displayed on a medium is detected by a photoelectric converter 1, and converted into an electric signal of predetermined voltage levels, in such a manner that the white space having a high optical reflectivity is converted to a low level (hereinafter referred to an "L") and a black bar having a high optical absorptivity is converted to a high level (hereinafter referred to an "H") of a read signal by a binary circuit 2 of detecting means into a binary signal. The binary signal is selectively applied through a first switching unit 3 to a space detector 4 or a second switching unit 5. The space detector 5 outputs a short pulse-like space detection signal when the binary signal is "L", and this space detection signal is applied to the first switching unit 3, a counter 6 of counting means and a third normally open switching unit 7. The first switching unit 3 is selectively switched by a slight delay from the space detection signal from the space detector 4 to the second switching unit 5 by the space detection signal, and selectively switched to the space detector 4 by the reset signal from a reset line 8. The second switching unit 5 selectively applies the binary signal to a first edge detector 9 or a second edge detector 10 of edge detecting means. The first edge detector 9 detects an edge from "L" to "H" of the initial bar of the binary signal to output a short pulse-like edge detection signal, and applies the edge detection signal to the second switching unit 5, the counter 6, a first margin comparator 11 and a normally open fourth switching unit 12. The second switching unit 5 is selectively switched by a slight delay from the edge detection signal from the first edge detector 9 to the second edge detector 10 by the edge detection signal of the first edge detector 9, and selectively switched to the first edge detector 9 by the reset signal rom the reset line 8. The second edge detector 10 detects an edge thereafter switched from "H" to "L" of the end of the initial bar of the binary signal to output a short pulse-like edge detection signal, and applies the edge detection signal to the counter 6, a bit image converter 13 and a normally open fifth switching unit 14. The counter 6 is reset by the space detection signal from the space detector 4, the edge detection signals from the first and second edge detectors 9, 10 and the reset signal of the reset line 8, starts counting, and applies the counted value of incoming clocks between the space detection signal and the edge detection signal and between the edge detection signal and the next edge detection signal to the third switching unit 7 and an overflow comparator 15. Another reset signal, not shown, to reset the counter 6 and to newly start counting is supplied to the reset line 8 when a power source is energized and by external resetting means. A first constant register 16 is set in advance with a large first constant value smaller than the maximum counted value of the counter 6. The overflow comparator 15 compares the first constant value with the counted value, and outputs a reset signal to the reset line 8 when the counted value is larger than the first constant value. The third switching unit 7 is closed by the space detection signal, and opened by the reset signal from the reset line 8. The counted value is applied through.the third switching unit 7 to a first counter memory 17 and a second counter memory 18. The counted value stored in the first counter memory 17 is compared by the first margin comparator 11 with the second constant value set in advance in a second constant register 19. The second constant value is set to a value equal to or larger than the counted value obtained from a wide space to be scanned on a bar code at a normal speed and marginal by sufficiently considering the variation in the scanning speed of the photoelectric converter. The first margin comparator 11 outputs a reset signal to the reset line 8 if the counted value is smaller than the second constant value when the edge detection signal is applied from the first edge detector 9. The counted value stored in the second counter memory 18 is applied to a fifth switching unit 14 and a second margin comparator 20. The fifth switching unit 14 is closed whenever the edge detection signal is applied from the second edge detector 10 to apply the counter value of the second counter memory 18 to the bit image converter 13. The counted value of the second counter memory 18 is compared with the third constant value set in advance in a third constant register 21 by the second margin comparator 20, and applies a decision signal to the fourth switching unit 12 when the counted value is equal to or larger than the third constant value. The third constant value is set to a value larger than the counted value obtained from a wide space by scanning it on a bar code at a normal speed by the photoelectric converter 1 and marginal by sufficiently considering the variation in the scanning speed of the photoelectric converter. The fourth switching unit 12 is closed by the edge detection signal of the first edge detector 9 and opened by the reset signal of the reset line 8. The decision signal is applied through the closed fourth switching unit 12 to a bit image memory 22 and a character converter 23. The bit image converter 13 reads the counted value of the second counter memory 18 in response to the edge detection signal from the second edge detector 10 to suitably convert it to an image signal, stores it in the bit image memory 22, and outputs the reset signal to the reset line 8 if it cannot convert it to an image signal. The stored value is read in the bit image memory 22 by the decision signal from the second margin comparator 20, applied to the character converter 23, and the stored value is cleared by the reset signal of the reset line 8. The character converter 23 converts the image signal by the decision signal into a character signal to apply it to an output circuit 24, and outputs the reset signal to the reset line 8 if it cannot convert it into a character signal. The output circuit 24 converts the character signal to a suitable output format adapted for an external unit to output it, and outputs a reset signal to the reset line 8 when it finishes to output it.
The configuration having the above-mentioned final display judging sequence is explained with reference to Table 1 in "Manufacture of Bar Code System" described on pages 438 to 451 of the magazine "Transistor Technique" issued by CQ Publishing company, in Japan on Apr. 1, 1984, and the content partly corrected is disclosed in Table 2 of "Manufacture of Bar Code System" described on pages 179 to 199 of "Sensor Interfacing No. 4" of "Transistor Technique" of separate volume and "Transistor Technique Edition" of separate volume issued by CQ Publishing company, in Japan on July 1, 1984.
In this configuration, a sufficient starting margin is provided before the bar code. Thus, when the photoelectric converter 1 is scanned from the starting position sufficiently separated from the bar code on the bar code, the binary signal becomes "L" by the starting margin, the space detection signal is outputted from the space detector 4, the binary signal is then switched by the initial bar from "L" to "H", and the counted value counted by the counter 6 becomes the second constant value or larger during a period until the edge detection signal is outputted by the first edge detector 9. Thus, the reset signal is not outputted from the first margin comparator 11, and a suitable start is judged. Here, if the photoelectric converter 1 is scanned from the position near the bar code and a contaminant exists on the way to the bar code, the counted value of the counter 6 is yet smaller than the second constant value when the edge detection signal is outputted from the first edge detector 9, the reset signal is outputted from the first margin comparator 11 to be suitably started.
When a suitable start is executed in this manner, an edge detection signal is outputted from the second edge detector 10 whenever the bar and the space is switched, and the counted value between the edge and the next edge is sequentially read by the bit image converter 13.
The photoelectric converter 1 is assumed to be scanned on a stop margin and further a contaminant D provided immediately after the end of the bar code as shown in FIG. 32(1) at the end of the bar code. Here, if the photoelectric converter 11 is scanned at a slow speed, the binary circuit 2 outputs a binary signal as shown in FIG. 32(2). If the binary signal becomes "L" by the end of the last bar and the counted value t.sub.1 until it becomes again "H" is larger than the third constant value tc, the second margin comparator 20 outputs a decision signal when the counted value becomes equal to the third constant value tc, and the final display decision is suitably executed. The fourth switching unit 12 is closed at this time, the decision signal is applied to the bit image memory 22 and the character converter 23, and a suitable output is produced from the output circuit 24.
FIG. 33 is a block diagram for explaining a circuit arrangement of an optical code reading apparatus (hereinafter referred to as "a bar code reader") as a representative example of a code reading apparatus according to another prior art. Reference numeral 101 designates a photoelectric conversion unit, numeral 102 denotes a first space detection unit, numeral 103 depicts a first edge detection unit, numeral 104 indicates a counter unit, numeral 105 designates a start margin discriminator (start discriminator), numeral 107 denotes a decoder unit and numeral 110 depicts a stop margin discriminator (stop discriminator).
FIGS. 34 to 37 are explanatory views of the operation of a bar code reader shown in FIG. 33.
In FIG. 33, the photoelectric conversion unit 101 has a photoelectric converter 1 and a binary circuit 2. A code in which spaces each having a high optical reflection efficiency and bars each having high optical absorptivity of two states are alternately displayed on a medium is detected by a photoelectric converter 1, and converted into an electric signal a of predetermined voltage levels, in such a manner that the white space having a high optical reflectivity is converted to a low level (hereinafter referred to an "L") and a black bar having a high optical absorptivity is converted to a high level (hereinafter referred to an "H") of a read signal by a binary circuit 2 of detecting means into a binary signal b.
The first space detection unit 102 has a switching unit 3 and a space detector 4, and the binary signal b from the photoelectric conversion unit 101 is applied through the switching unit 3 to the space detector 4 or a switching unit 5. The switching unit 3 is connected to the side of the space detector 4 by a reset signal at the initial time. As shown in FIG. 34, the photoelectric conversion unit 101 supplies an "L" signal to the space detector 4 at the space (first space) forward of the displaying position when it starts scanning from the forward of the display position of the bar code. The output of the space detector 4 is applied to the first counter 8 of the counter unit 104, and a signal e is applied to a first counter 8 when a signal c obtained from the space immediately before by the space detector 4 is "L". The first counter 8 is cleared to "0" by the input of the output e and starts counting clock inputs.
The output e from the space detector 4 switches the switching unit 3 to the side of the first edge detection unit 103 to stand by for detecting the first edge. The first counter 8 counts the clocks corresponding to the continuous time of the output e. When the counted value arrives at the overflow value of the counter (e.g., in the state that the photoelectric conversion unit is stopped on the space), it is compared by the overflow comparator 10 with the overflow value set in a first constant register 9, a reset signal is outputted to reset the entire system including the first counter.
The counted value j counted by the first counter 8 is stored in a first counter memory 12 of the start margin discriminator 105 through a switching unit 11, and compared by a first margin comparator 14 with a set value of a second constant register 13 by a signal from a signal line h.
As shown by a in FIG. 34, the output j, i.e., the output 1 to be stored in the first counter memory 12 is represented by t.sub.M (counting time of a space immediately before the bar code, and a start margin time t.sub.s set in the second constant register 13 is provided. If t.sub.M is larger than t.sub.s, it is judged that the starting position is sufficiently separated from the bar code as shown in FIG. 35(a).
As shown in FIG. 35(c), if t.sub.M is smaller than t.sub.s at this time, a reset signal is outputted from the first margin comparator 14 as that the start cannot be decided, and the reading operation is stopped.
As shown in FIG. 35(b), even if the starting position is sufficiently separated from the bar code, if there is a contaminant P on the way from the starting position, the counting time t.sub.Ml from the starting position to the contaminant P and the counting time t.sub.M2 from the contaminant P to the position of the bar code become smaller than t.sub.s (t.sub.M1 is smaller than t.sub.s, t.sub.M2 is smaller than t.sub.s), and it is judged that the start cannot be decided.
When the starting position is disposed near the bar code as shown in FIG. 34(c), the counting time t.sub.M from the starting position to the bar code becomes smaller than t.sub.s, and it is also judged that the start cannot be decided.
In the cases of FIGS. 34(b) and 34(c), the reset signal is outputted from the start margin discriminator 105, and the bar code is not read.
In case that t.sub.M is larger than t.sub.s as shown in FIG. 34(a), the output e of the space detector is applied also to the switching unit 3 to switch the switching unit 3 to the side of the switching unit 5. Thus, a signal f converted from "L" to "H" by the variation (at a point (1) in FIG. 34) outputted from the photoelectric conversion unit 101 when arriving at the initial bar code from the space is detected by the first edge detector 6 of the first edge detection unit 103. When this is detected in this manner, the detection output h switches the switching unit 5 to the side of the second edge detector 7, and starts counting clocks applied to the first counter 8 of the counter unit 104. The switching unit 11 is switched to the side of the stop margin discriminator 110 by the output e of the space detector 4. The second edge detector 7 detects the next edge of the bar code, i.e., the variation of "H" to "L" at a point (2) in FIG. 34 to output a signal i.
The counted value counted by the first counter 8 from when the first edge detector 6 detects the first edge is stored in the second counter memory 15 of the stop margin discriminator 110 at a time point when he second edge detector 7 detects the second edge (at the time of the signal output of the signal line i), and the output O of the memory 15 is supplied from the signal line t through a switching unit 16 operated by the signal of the signal line i to the decoder unit 107. In other words, the counted value corresponding to the width of "bar B1" of the bar code from the point (1) to the point (2) in FIG. 34 is applied to the decoder unit 107 at this time.
Then, the variation of "H" to "L" at the point (2) from a in FIG. 34 and the variation of "L"to "H" of the point c in FIG. 34 are sequentially detected by the edge detector 7, and the counted value from the point (2) to the point (3) is applied to the decoder unit 107.
Similarly, the counted values corresponding to the widths of the space and the bar of the bar code are sequentially applied to the decoder unit 107.
As described above, the start margin discriminator 105 confirms whether the initial space satisfies the starting margin or not, and outputs a reset signal when it does not satisfy that to eliminate the start of the reading operation.
A switching unit 22 feeds a signal of a signal line u from the stop margin discriminator 110 to the decoder unit 107 when the signal of the signal line h from the first edge detection unit 103 is applied thereto.
The second constant register 13 of the start margin discriminator 105 is set in advance with a constant corresponding to the starting margin as described above, and applies its value n to the first margin comparator 14. The margin comparator 14 operates when the signal of the signal line h is inputted thereto to compare the counted value m from the first counter memory 12 with the signal n and outputs a reset signal when m is smaller than n to eliminate the reading operation of the bar code.
When the reading of the bar code is finished and a space is again scanned, the counted value (signal line 1) counted by the first counter 8 from the time point of variation at point (4) in FIG. 36 is stored in the second counter memory 15 of the stop margin discriminator 110. This counted value t.sub.N is compared by a second margin comparator with the value t.sub.c (signal line s) corresponding to the stop margin set in a seventh constant register 42.
The set value t.sub.c is set by considering the variation of the scanning speed by an operator or at the operating time of a bar code reader. If t.sub.c is smaller than t.sub.N as shown in FIGS. 37(a) and 37(b) corresponding to slow or fast time of the scanning speed shown by a or b in FIG. 36, it is judged that the bar code is finished to read, the switching unit 22 is switched, and a decode command is applied as a comparison signal v to the decoder unit 107.
As shown at c in FIG. 36, when a contaminant P' exists on a space obtained as a stop margin and t.sub.N is smaller than t.sub.c, there is a possibility that it is erroneously read as a bar code as shown in FIG. 37(c). As described above, the constant corresponding to the stop margin is set in advance in the seventh constant register 42, the value (s) is fed to the second margin comparator 20, and the signal u is applied through the switching unit 22 to the decoder unit 107 when the counted value of the bars or the spaces becomes the constant or larger.
In the description above, the levels of the signals are set to "L" or "H" in the state that the space is white and the bar is black, but they are not limited to them.
The prior art of this type is disclosed in Japanese Patent Publication No. 35707/1985.
In the prior art, since the start of the bar code is judged when the space immediately before the bar code is detected to be a predetermined constant distance (a distance longer than the width of a wide space) or longer or a predetermined time (a time longer than the counting time of the width of the wide space) or longer, the space immediately before the bar code is necessary to be the predetermined distance or time or longer. Thus, it is difficult to densify the display of the bar code, and there is a high possibility that a contaminant exists on the space to be easily erroneously operated.
Since the decoding operation is controlled by regarding as the end of the bar code when the counted value of the bar or the space is equal to or larger than the predetermined value, the width of the space/the bar necessary for the stopping margin is varied according to the scanning speed of the bar code reader. Thus, the width of the stopping margin must be increased to correspond to the fast scanning speed, it is difficult to densify the display of the bar code, and there is a high possibility that a contaminant exists on the margin to be easily erroneously operated.
In order to countermeasure it, it is proposed to minimize the starting and stopping margins to the necessary limit and to narrow the width of the bar or the space of the bar code itself to density it or to reduce the reading errors by judging the decision of the possibility of starting or stopping by comparing the counted value immediately before with the predetermined value or the value multiplied by the constant.
FIG. 38 is a block diagram showing the arrangement of the prior art. Reference numeral 101 designates a photoelectric conversion unit, numeral 102 denotes a first space detection unit, numeral 103 depicts a first edge detection unit, numeral 104 indicates a counter unit, numeral 106 designates a stop discriminator, numeral 107 denotes a decoder unit, numeral 108 indicates a first bar/space discriminator, numeral 109 designates a start discriminator, numeral 7 denotes a second edge detector, and numerals 11, 21, 22, 27, 31, 39 and 40 depict switching units.
The photoelectric conversion unit 101 first scans to read a code, such as a bar code by a photoelectric detector 1 to apply the read signal through a signal line a to a binary circuit 2 which converts it to binary level signals of "0" and "1" ("H", "L") and applies a conversion signal to the switching unit 3.
The switching unit 3 is initially connected by a reset signal to the side x in FIG. 38, and switched to the side y by the signal of a signal line e. Thus, the switching unit 3 connects a signal line b to a space detector 4 to apply an output to the signal line 3 when the signal of the signal line c corresponds to that of the space (e.g., "L") and switches itself to the side y. Thus, the signal b of the output line of the photoelectric conversion unit 101 is switched from the signal line d through the switching unit 3 to the switching unit 5. The switching unit 5 is connected by a reset signal to the side x. Thus, the signal line d is connected through a signal line f to the first edge detector 6.
The first edge detector 6 detects a variation of a signal from the signal line f from a space to a bar ("L" to "H") or a variation of a signal from the bar to the space ("H" to "L") when the signal from the signal line f is varied from the space to the bar or from the bar to the space and applies an output to a signal line h. An edge detection signal on the signal line h switches the switching unit 5 to the side 6 and is connected to the first counter 8 of the counter unit 104 to set the counted value of the first counter 8 to "0" to start counting of clocks CL. The first counter 8 similarly clears it to "0" by the input of the reset signal or the signal input on the output line i of a second edge detector 7 to be described later to start counting, and feeds the counted value to the signal line j. The counted value of the first counter 8 is compared by an overflow comparator 10 with the overflow value (constant) set in the first constant register 9 of an overflow detection unit 100, and a reset signal is outputted from the overflow comparator 10 when the counter 8 overflows (e.g., when a scanner is stopped on the way).
The second edge detector 7 inputs a signal from the photoelectric conversion unit 101 through the switching units 3 and 5 according to the detection of the first edge of the first edge detector 6 to supply a detection signal through the signal line i to the first counter 8 when the signal on the input signal line g is varied ("H" to "L" or "L" to "H"), and applies it to the second counter 28 of the first bar/space discriminator 108.
The first bar/space discriminator 108 detects the first bar and then counts the sum of the bar and the space, and outputs a signal to a signal line 30a when the content of the second counter 28 arrives at a value set in advance in a fourth constant register 29 (counts the numbers of the space and the bar to decide the start).
The second counter 28 sequentially increments the counter by a signal from the signal line i and applies the counted value to a signal lines 28a. The counter is cleared to "0" by the reset signal. The sum (2 or more) of the numbers of the bar and the space used to decide the start of the bar code is set in advance in the fourth constant register 29, and the value is fed by the signal lines 29a to a first margin comparator 30. The comparator 40 compares the counted value from the signal line 28a with the value from the signal line 29a, and outputs a signal to the signal line 30a when the counted value is equal to or larger than the set value of the fourth constant register 29.
The switching unit 31 applies a signal from the second edge detector to a start discriminator 109 and a switching unit 39 or a stop discriminator 106 and a switching unit 21. This switching is executed by the reset signal and the output signal of the first bar/space discriminator 108. When the reset signal is applied, the switching unit is switched from the side y to the side x, and when the signal is fed from the signal line 30a, it is switched from the side x to the side y.
The switching unit 11 is operated by the output signal of the first edge detector 6 from the signal h to feed the counted value from the counter 8 of the counter unit 104 to the start discriminator 109 and the stop discriminator 106.
The start discriminator 109 compares at least initial bar with the counted value of the space, and judges as a start if the counted value of the space or the bar (the content of the first counter memory 12) is less than the magnification of a predetermined constant (the content of the sixth constant register 36) of the counted value of the space or the bar immediately before (the content of the second previous counter memory 35) to apply a reset signal to the signal line 38a when it becomes the magnification or more of the predetermined constant. In other words, in case of judging the start, at least initial counted value of the bar or space is compared without observing the starting margin, and the reset signal is output to stop reading when judging no start as described above.
The first counter memory 12 stores the counted value from the signal line 1, and applies it to a signal line m. Then, the stored counted value is reset by the reset signal.
Larger counted value (than a wide bar or a space/slow scanning speed) is set in advance in the fifth constant register 33, applied to the signal line 33a, and stored in the second previous counter memory 35 through a switching unit 34 for connecting the signal line 33a to the signal line 32a only when the reset signal is applied thereto. The counted value thus stored is applied through the signal line 35a to a second multiplier 37, in which it is multiplied by the larger value than (wide bar or space/narrow bar or space) set in the sixth constant register 36. The multiplied result is supplied through the signal line 37a to a third margin comparator 38.
The third margin comparator 38 compares the output signal (counted value) of the first counter memory 12 from the signal line m with the multiplied output value of the second multiplier 37, and outputs a signal to the signal line 38a when the counted value is the multiplied output value or larger.
The switching unit 40 operates (i) to connect the signal line 38a to the reset line when the reset signal is inputted to output the signal from the signal line 38a as a reset signal, and (ii) to separate the signal line 38a from the reset output line when the signal from the signal line 30a (the output of the first bar/space discriminator 108) is inputted. The switching unit 32 connects the signal line m to the signal line 32a only when a signal is inputted from the signal line 31a, supplies the stored value of the first counter memory 12 to the second previous counter memory 35, and disconnect the signal line m from the signal line 32a except the above cases.
The switching unit 39 connects the signal line m to the signal line t only when the signal from the signal line 31a is inputted and supplies the value of the first counter memory 12 to the decoder unit 107.
The switching units 39, 21 are operated by the signal from the second edge detector 7, the switching unit 39 applies the counted value of the bar or space from the first counter memory 12 and the switching unit 21 applies the counted value of the bar or space from the second counter memory 15 to be described later, to the decoder unit 107.
The switching unit 27 is operated only when the signal from the signal line 30a is inputted, i.e., by the signal from the first bar/space discriminator 108 to lead the signal from the signal line m to the signal line p to supply the counted value of the final bar or space used to decide in the start discriminator 109 to the first previous counter memory 17 of the stop discriminator 106.
Then, the operation of the stop discriminator 106 will be described.
The stop discriminator 106 applies a signal to the signal line u when the counted value of the bar or space to be read at present, i.e., the content of the second counter memory 15 becomes the counted value of the space or bar immediately before, i.e., the magnification of the constant (the value set in the third constant register 18) of the content of the previous counter memory 17. The second counter memory 15 stores the signal from the signal line 1, i.e., the counted value of the first counter 8 of the counter unit 104, and applies it to the signal line o. The switching unit 16 connects the signal line o to the signal line p only when the signal from the signal line 31b, i.e, the output signal of the second edge detector 7 through the switching unit 31 is inputted and applies the value of the second counter memory 15 to the first previous counter memory 17. The first previous counter memory 17 stores the signal from the signal line p, and applies the value through a signal line q to the first multiplier 19. A value larger than the counted value of (wide bar or space/narrow bar or space) of the bar code is set in advance in the third constant register 18, the set value is applied through a signal line r to the first multiplier 19, multiplied by the value stored in the first previous counter memory 17, and outputted through the signal line s to the second margin comparator 20.
The second margin comparator 20 compares the value of the second counter memory 15 inputted through the signal line o with the multiplied output of the first multiplier 19, and applies a comparison output to the signal line 7 when the value from the second counter memory 15, i.e., the counted value of the first counter 8 of the counter unit 104 is the output value or more of the first multiplier 19.
The switching unit 22 which inputs the output of the stop discriminator 106 disconnects the signal line u from the signal line v when the reset signal is inputted, and connects the signal line u to the signal line v by the output signal from the first bar/space discriminator 108 from the signal line 30a. In other words, the output signal from the stop discriminator 106 is applied to the decoder unit 107 from when the first bar/space decision signal (starting margin decision signal) from the first bar/space discriminator 108 is inputted to control the decoding operation.
The decoder unit 107 decodes the meaning of the code of the bar code according to the counted value of the clock CL corresponding to the width of the bar or space of the read bar code, and has an arrangement as shown in FIG. 38.
The functions of the blocks of the decoder unit 107 shown in FIG. 38 are as described below.
The bit image converter 23 is operated by the detection output of the second edge detector 7 from the signal line i to convert the counted value inputted from the signal line t, and stores it through a signal line 2 in a bit image memory 24. When an error is generated at the time of the conversion, a reset signal is outputted. The bit image memory 24 operates (i) to store a bit image from the signal line w, (ii) to apply a bit image stored by a signal input from the signal line v through a signal line x to a character converter 25, and (iii) to clear the bit image stored when the reset signal is inputted.
The character converter 25 starts operating by a signal input from the signal line v, converts a bit image inputted from the bit image memory 24 into a character, and applies it, through a signal line y to the output circuit 26. If an error is generated in case of the character conversion, the reset signal is outputted.
The output circuit 26 applies a data character signal from the signal line y to an output line z, and supplies it to display means, not shown, or other information processor. The reset signal is outputted when the signal is completely outputted.
In the arrangement described above, to decide the starting margin or the stopping margin, the counted value of the present bar or space by scanning of reading the bar code is compared by the value multiplied by a predetermined constant of the counted value of the space or bar of the previous time. In other words, since the start or stop is judged in relation to the counted value at present with the counted value immediately before, the width of the space (for the starting margin or stopping margin) to be installed around a display code can be reduced and the width of the bar or space for forming the code is not according to the scanning speed of reading, the code display can be densified. Thus, the probability that a contaminant is adhered to the code display is reduced to decrease the occurrence of an erroneous operation.
In the prior art, since the decision of the stop is executed at the magnification of the constant of the counted value of the last bar or space, the stop deciding distance of twice or more of the case of the narrow bar or narrow space is required if the last bar or space is of a wide bar or a wide space.
FIG. 39 is an explanatory view of an example of discriminating the stop according to the prior art. FIG. 39(a) shows a bar code, where B.sub.N is a narrow bar, B.sub.W is a wide bar, and C is a scanning direction. FIG. 39(b) shows a waveform obtained by scanning the bar code of FIG. 39(a), where t.sub.A is the counted value of the narrow bar B.sub.N, t.sub.B is the counted value of the wide bar B.sub.W, and A is a predetermined constant.
As shown in FIG. 39, the stop is discriminated when it becomes the magnification of the predetermined constant (A) of the last bar or space (the wide bar B.sub.W) in FIG. 39) of the bar code in the prior art arrangement in FIG. 38.
In the arrangement in FIG. 38, the start is discriminated by comparing the initial bar with the next space, the start is discriminated when the counted value of the next space is smaller than the value produced by multiplying the counted value of the minimum bar by the predetermined constant, the reading is then continued, while the reset is applied when it is larger than that, and new reading is started.
FIG. 40 is an explanatory view of the start discriminating operation according to the prior art, FIG. 40(a) shows a bar code, where P is a contaminant, B.sub.N is a first bar (narrow), and S.sub.N is a space (narrow), and FIG. 40(b) shows the reading waveform of FIG. 40(a) by the counted value of the clock, where t.sub.A is the counted value of the contaminant P, and B is set to a value larger than the constant (the wide bar or space/the narrow bar or space).
In the prior art described with respect to FIG. 38, the discrimination of the stop becomes difficult due to the difference of scanning speeds, and particularly to low scanning speed, and repeated reading operation might be performed.
More specifically, the photoelectric conversion unit 101 scans to read the bar code of the code, converts it to a binary level signal of "H", "L", and outputs it. The counter unit 104 counts and outputs the time of "H" and "L" from the photoelectric conversion unit 101 by a clock signal CL, and there are considered as the counting (i) a method of sequentially outputting the value (counted value) during counting, (ii) a method of outputting the counted value at each end of counting "H" and "L", and (iii) a method of temporarily storing the counted value of "H" and "L" and outputting it after the counting of the bar code is finished.
The start discriminator 109 discriminates the start by the counted value from the counter unit 104, and resets the operation of the counter unit 104 when a starting error is judged. The stop discriminator 106 discriminates the stop by the counted value outputted from the counter unit 04, and decodes the counted value outputted from the counter unit 104 by the decoder unit 107. The decoder unit 107 decodes the counted value from the counter unit 104, and outputs the resulting reading data.
FIG. 41 shows a block diagram showing other example of a conventional code reading apparatus, which is the same as that in FIG. 38 except that the functions of the start discriminator 109 and the stop discriminator 106 are executed by a common start/stop discriminator. Therefore, the description of FIG. 41 will be omitted for the same description as that in FIG. 38 regarding the start/stop discriminator.
In FIG. 41, the start/stop discriminator 110 has the functions of discriminating both the start and the stop, and the switching unit 31 for switching the edge detection signal of the edge detector 109 to the start discriminator 109 and the stop discriminator 106 is eliminated.
The start/stop discriminator 110 is operated to compare at least counted value of the initial bar and space, and applies a reset signal to a signal line 38a when the counted value (the content of the counter memory 12) of the space or bar becomes the magnification of a predetermined constant (the content of the sixth constant register 36) of the counted value (the content of the previous counter memory 35) immediately before. In other words, in case of discriminating the start, at least counted value of the initial bar and space is compared without observing the start margin, and the reset signal is outputted when no start is judged as described above.
The counter memory 12 stores the counted value from a signal line 1, and applies it to the signal line m. Then, the stored counted value is reset by the reset signal.
The larger counted value (than the wide bar or space/the slow scanning speed) is set in advance in the fifth constant register 33, the value is applied to the signal line 33a, and stored in the previous counter memory 35 through the switching unit 34 for connecting the signal line 33a to the signal line 32a only when the reset signal is inputted thereto. The stored counted value is applied through a signal line 35a to a multiplier 37, in which it is multiplied by the constant set in the sixth constant register 36, i.e., the larger value (than the wide bar or space/narrow bar or space). The multiplied result is supplied through a signal line 37a to a margin comparator 38.
The margin comparator 38 compares the output signal (counted value) of the counter memory 12 from the signal line m with the multiplied output value of the multiplier 37, and outputs a signal to the signal line 38a when the counted value is equal to or larger than the multiplied output value.
The switching unit 40 (i) connects the signal lie 38a to the reset line when the reset signal is inputted, and outputs the signal of reading stop from the signal line 38a as a reset signal, and (ii) disconnects the signal line 30a from the reset output line and connects the signal line 38a to the signal line v when the signal (the output signal of the first bar/space discriminator 108) from the signal line 30a is inputted thereto.
The switching unit 39 connects the signal line m to the signal line t only when the signal from the signal line i is inputted thereto, and supplies the value of the first counter memory 12 to the decoder unit 107.
The stop discrimination applies a signal to the signal line 37a when the counted value of the bar or space to be read at present, i.e., the content of the first counter memory 12 becomes the counted value of the space or bar immediately before, i.e., the magnification of the constant (the value set in the third constant register 36) of the content of the previous counter memory 35. The counter memory 12 stores the signal from the signal line 1, i.e., the counted value of the first counter 8 of the counter unit 104, and applies it to the signal line m. The switching unit 32 applies the value of the counter memory 12 to the previous counter memory 35 by the signal from the signal line i. The previous counter memory 35 stores the signal from the signal line 32a, and applies the value through a signal line 35a to the first multiplier 37. A value larger than the counted value of (wide bar or space/narrow bar or space) of the bar code is set in advance in the sixth constant register 36, the set value is applied through a signal line 38a to the multiplier 37, multiplied by the value stored in the previous counter memory 35, and outputted through the signal line 37a to the margin comparator 38.
The margin comparator 38 compares the value of the counter memory 12 with the multiplied output of the multiplier 37, and applies a comparison output to the signal line 38a when the value from the counter memory 12, i.e., the counted value of the first counter 8 of the counter unit 104 is the output value or more of the multiplier 37.
The switching unit 40 which inputs the output of the margin comparator 38 disconnects the signal line 38a from the signal line v when the reset signal is inputted thereto, and connects the signal line 38a to the signal line v by the output signal from the first bar/space discriminator 008 from the signal line 30a. In other words, the output signal from the stop discriminator 108 is applied to the decoder unit 107 from when the first bar/space decision signal (starting margin decision signal) from the first bar/space discriminator 108 is inputted to control the decoding operation.
The decoder unit 107 decodes the meaning of the code of the bar code according to the counted value of the clock CL corresponding to the width of the bar or space of the read bar code, and has an arrangement as shown in FIG. 38.
FIG. 28 is a schematic block diagram of a bar code reading apparatus for describing an example of a code reading apparatus of this type considered to compensate the variation of the scanning speed. Reference numeral 10 designates a photoelectric conversion unit, numeral 20 denotes a counter unit, numeral 30 depicts a start/stop discriminator, and numeral 40 indicates a decoder unit.
In FIG. 28, the photoelectric conversion unit 10 scans the bar code, converts it to a level signal of "H", "L", and outputs it. The counter unit 30 counts and outputs the time of "H" and "L" from the photoelectric conversion unit 10 by a clock signal CL, and there are considered as the counting (i) a method of sequentially outputting the value (counted value) during counting, (ii) a method of outputting the counted value at each end of counting "H" and "L", and (iii) a method of temporarily storing the counted value of "H" and "L" and outputting it after the counting of the bar code is finished.
The start/stop discriminator 30 discriminates the start/stop by the counted value from the counter unit 20, and resets the operation of the counter unit 20 when a starting error is judged. The stop discrimination decodes the counted value outputted from the counter unit 20. The decoder unit 40 decodes the counted value outputted from the counter unit 20 by the decoder unit 40. The decoder unit 40 decodes the counted value from the counter unit 20, and outputs the resulting reading data.
The decoder unit 40 has a function of converting (decoding) the counted value of the bar or space from the counter unit 20 into binary data ("1", "0"), and has a bit image converter 41, a bit image memory 42, a character converter 43, and an output circuit 44.
The bit image converter 41 compares the counted value of the clock signal CL corresponding to the bar or space from the counter unit 20 with a threshold value to convert it into a bit image signal, and stores it in the bit image memory 42. The character converter 43 converts the bit image signal from the bit image memory 42 into a character signal, and outputs it through the output circuit 44.
FIG. 42 shows a block diagram showing in detail the arrangement of the conventional bit image converter. A switching unit 51 connects the signal line w to the signal line 51a only when a switching signal from a comparator 68 to be described later is inputted thereto, and disconnects the signal line w from the signal line 51a except the case. A previous bit image memory 52 stores a bit image (corresponding to the bar or space read at present) from the comparator 68 inputted through the switching unit 51, and supplies the value through the signal line to a bit image discriminator 53, a switching unit 71 and a comparator 73. The bit image discriminator 53 discriminates the bit image read previously from the previous bit image memory 52, (i) applies a signal through a signal line 53a to a switching unit 69 when the bit image is "0 " , i.e., the narrow bar or narrow space of the bar code, and (ii) supplies a signal through a signal line 53b to the switching unit 71 when the bit image is "1" , i.e., the wide bar or wide space of the bar code. The switching unit 71 supplies the signal of the signal line 52a through the signal line 71a to the previous bit image memory 72 only when the switching signal is inputted thereto. The comparator 73 compares the previous bit image value of the previous bit image memory 52 from the signal lines 52a with the before previous bit image value of the before previous bit image memory 72 from the signal line 72a, and applies a comparison output to the signal line 73a when the previous bit image value is not equal to the before previous bit image value. The switching unit 69 disconnects the signal line 53a from the signal line 69a only when the output of the comparator 73 is inputted from the signal line 73a thereto, and connects the signal line 53a to the signal line 69a except the case. The switching unit 70 disconnects the signal line 53b from the signal line 70a by the output of the comparator 73 from the signal line 73a, and connects the signal line 53b to the signal line 70a except the case.
A switching unit 54 supplies the counted value from a counter memory 67 through a signal line 67a to a previous counter memory 55 only when a switching signal is inputted thereto, and disconnects the signal line 67a from the signal line 54a except the case. The previous counter memory 55 stores the counted value of the counter memory 67 through the signal line 67a, the switching unit 54 and the signal line 54a. A multiplier 56 triples the counted value of the previous counter memory 55 from the signal line 55a, and feeds the result through the signal line 56a to a divider 57.
The divider 57 divides the multiplication output of the multiplier 56 by 2, and applies the result through the signal line 57a to a switching unit 58.
The switching unit 58 connects the signal line 57a to the signal line 58a by the signal of the signal line 69a, and disconnects the signal line 57a from the signal line 58a when no signal exists on the signal line 69a.
A multiplier 59 triples the counted value of the previous counter memory 55, and applies the value through the signal line 59a to a divider 60. The divider 60 divides the multiplication output of the multiplier 59 by 4, and applies the result through the signal line 60a to a switching unit 61. The switching unit 61 connects the signal line 60a to the signal line 58a by the signal of the signal line 70a, and disconnects the signal line 60a from the signal line 58a except the case.
A switching unit 74 stores the counted value of the previous counter memory 55 through the signal line 55a in a before previous counter memory 75 from the signal line 74a only when a switching signal is inputted thereto. The counted value stored in the before previous counter memory 75 is added to the counted value stored in the previous counter memory 55 by an adder 76, and supplied through the signal line 76a to a divider 77. The divider 77 divides the addition output of the adder 76 by 2, and applies the division output through the signal line 77a to a switching unit 78. The switching unit 78 connects the signal line 77a to the signal line 58a by the signal on the signal line 73a, and disconnects the signal line 77a from the signal line 58a except the case.
A switching unit 62 connects the signal line 66a to the signal line 62a only when a switching signal is inputted thereto, and disconnects the signal line 66a from the signal line 62a except the case.
A previous Th value memory 63 for storing the previous threshold value stores the threshold value in the previous process, and applies it through the signal line 63a to an adder 64. The adder 64 inputs any signal from the switching units 58, 61 and 78 through the signal line 58a, adds it to the previous Th value stored in the previous Th value memory 63, and applies the addition result through the signal line 65a to a divider 65.
The divider 65 divides the addition result of the adder 64 by 2, and stores the result through the signal line 65a as this time threshold value in a Th value memory 66. The threshold value stored in the Th value memory 66 is supplied to the comparator 68, and used as a reference value for binarily judging the present counted value inputted through the signal line t (the counted number of clocks corresponding to the bar or space from the counter unit 20 in FIG. 28). In other words, the comparator 68 is operated when the edge detection signal (the detection signal of the trailing edge of the bar or space) from the signal line 9 introduced by edge detecting means, not shown, provided in the counter unit 20 is inputted thereto, compares the counted value inputted from the signal line t with the threshold value, (i) feeds a "1" signal to the signal line w (corresponding to the wide bar or wide space) and generates a switching signal in case that the counted value is larger than the threshold value, and (ii) applies "0" to the signal line w (corresponding to the narrow bar or narrow space) and supplies a switching signal in case that the counted value is smaller than the threshold value.
The counter memory 67 stores the counted value from the signal line t by the edge detection signal from the signal line i, and stores it through the signal line 67a and the switching unit 54 in the previous counter memory 55.
Then, the operation of the arrangement constructed as described above will be described.
FIG. 43 is an explanatory view of the operation of the arrangements in FIGS. 28 and 42, wherein FIG. 43(a) shows a bar code, FIGS. 43(b) to 43(e) are concept views for explaining the conversion of the counted value to the bit image.
In FIG. 43(a), B.sub.N is a narrow bar, S.sub.N is a narrow space, B.sub.W is a wide bar, S.sub.W is a wide space, and C is a scanning direction of reading. In FIGS. 43(b) to 43(e), t.sub.A is the counted value of the before previous bar or space, t.sub.B is the counted value of the previous bar or space, and t.sub.C is the counted value of the present bar or space (this time).
In the prior art shown in FIG. 42, the threshold value for discriminating the binary value ("1", "0") of the present bar or space is decided by observing how the previous bar or space and the before previous bar or space are. Thus, as shown in FIG. 42, the previous bit image memory 52 and the before previous bit image memory 72 are provided to detect the same or difference and the magnitude of both, i.e., the type of the narrow bar or space or the wide bar or space, and the previous counter memory 55 and the before previous counter memory 75 are provided to set the threshold value according to the detection of the same or difference and the type of both.
More specifically, as shown in FIG. 43(b), when both are narrow by the judgement of the counted values of the counted values t.sub.A, t.sub.B of the previous and before previous bar or space, the previous counted value t.sub.A stored in the previous counter memory 55 through the switching unit 69 and the switching unit 58 is multiplied by 3/2 to produce a value 3/2(t.sub.A), the value 3/2(t.sub.A) is applied to the adder 64, the threshold value Th is decided with the mean value of the value (i.e., the threshold value used to decide the before previous bar or space) of the previous Th value memory, applied to the comparator 68, and set to "1" in case that t.sub.C is larger than Th, or set to "0" in case that t.sub.C is smaller than Th.
Similarly, as shown in FIG. 43(c), when the previous and the before previous bar or space are both wide, the previous counted value t.sub.A is multiplied by 3/4 by the switching units 61, 70 to produce 3/4 (t.sub.A), and the 3/4(t.sub.A) is used as the threshold value.
As shown in FIGS. 43(d) and 43(e), when the previous and the before previous bar or space are different, the switching unit 78 is opened, and the mean value 1/2(t.sub.A +t.sub.B) of the previous and the before previous counted values is applied as the threshold value Th to the comparator 68.
In the process described above, an error is suppressed due to the printing error or the variation of the reading speed of the width of the bar code on the medium to be accurately read.
However, as shown in FIGS. 30(1)(b), if the contaminant D exists before the bar code, the suitable discrimination of the start cannot be decided by the conventional apparatus shown in FIG. 29 even if the photoelectric converter 1 is scanned on the bar code from the starting position sufficiently separated from the bar code.
The binary signal is outputted as shown in FIG. 30(3) from the binary circuit 2 by scanning the photoelectric converter 1 as shown in FIG. 30(1)(b). Then, the edge (1)' is detected by the fall detector 5, the counter 6 starts counting, and the counted value t.sub.b1 until the edge (2)' is detected by the edge detector 4 is smaller than the constant value. Thus, a signal is not yet outputted from the comparator 12, and the third self-holding circuit 17 remains the set state, and the second switch 8 remains closed. Then, the edge detection signal outputted from the edge detector 4 at the edge (2)' is applied through the second switch 8 to the reset line 13 as a reset signal to stop counting of the counter 6, and the first and second self-holding circuits 7, 10 are reset. Thus, the counted value between the edge (2)' and the next edge (3)' is not read in the bit image converter 11. Further, the edge (3)' is detected by the fall detector 5 to start counting of the counter 6, but if the counted value t.sub.b2 until the next edge (4)' is detected by the edge detector 4 is smaller than the constant value, the edge detection signal of the edge (4)' is, similarly to the above, applied as a reset signal to the reset line 13, and the counted value between the edge (4)' and the next edge (5)' is not read in the bit image converter 11. In this manner, if the contaminant D exists before the bar code, the sufficient starting margin is not to be provided, and suitable start cannot be discriminated.
As shown in FIG. 30(1)(c), even if the photoelectric converter 1 is scanned on the bar code from the starting position near the bar code, suitable start cannot be discriminated. Thus, the binary signal as shown in FIG. 30(4) is outputted from the binary circuit 1 by scanning the photoelectric converter 1 as shown in FIG. 30(1)(c). Then, the counted value t.sub.c counted between the edge (1)" and the next edge (2)" is smaller than the constant value, and the start cannot be discriminated similarly to the above.
If the bar code surface is contaminated, the width of the bar and the space is erroneously detected, and the bar code is not suitably read. Then, the conventional optical reader of the bar code reader presumes that the bar code surface is not contaminated if no contaminant D exists on the space of the predetermined width provided immediately before the bar code. Thus, the starting margin is provided immediately before the bar code to scan the starting margin by the photoelectric converter 1. The space of the width which is ten times as large as the narrow bar is provided as the starting margin.
Therefore, the code reading apparatus of the conventional bar code reader has a problem that the bar code cannot be densely disposed in the amount of providing the starting margin of sufficient width.
There is other conventional example of a code reading apparatus of the bar code reader which compares the value responsive to the time to the rise of the initial bar from the fall of the binary signal due to the start of scanning the photoelectric converter 1 with the product of the constant value of the value responsive to the elapsed time by the width of the initial bar to discriminate the start, but still needs the space as the starting margin of the width from the starting position of starting scanning to the initial bar.